package com.web.action;

import com.model.user;
import com.service.userService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller("userAction")
@Scope("prototype")//默认单例，想要多例就写这个
public class userAction {

//    @Autowired//spring自动注入
//    @Qualifier("userService")//根据id注入

    @Resource(name = "userServiceImpl")//等同于上面两个
    public userService userService;

//    public com.service.userService getUserService() {
//        return userService;
//    }
//
//    public void setUserService(com.service.userService userService) {
//        this.userService = userService;
//    }

    public void save(user u){
        System.out.println("action的save方法.....");

        userService.add(u);
    }
}
